<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <title>客房管理</title>
    <link href="<{$ipath}>user/style/my_service_css.css" type="text/css" rel="stylesheet">
    <link href="<{$ipath}>app/hotel/style/room_css.css" type="text/css" rel="stylesheet">
    <script src="<{$ipath}>public/js/jquery.js"></script>
   <script>
	function getheigth(obj,pop){
		$(pop).show();
		var t = parseInt($(obj).offset().top - $(pop).find('.floor_tan').height()/2);
		$(pop).find('.floor_tan').css({
			top : t
		});
	}
		
    </script>
    <style type="text/css">
        .layer,.layer_edit {
            background: #fff none repeat scroll 0 0;
            border: 1px solid #61c6d0;
            height: 400px;
            left: 50%;
            margin-left: -425px;
            position: absolute;
            top: 50%;
            width: 850px;
			border-radius:10px;
        }
        .top {
            background: #61c6d0 none repeat scroll 0 0;
            font-size: 18px;
            height: 40px;
            line-height: 40px;
            width: 100%;
        }
        .top li {
            color: #fff;
            float: left;
            padding: 0 10px;
        }
        .top .number span {
            background: #4e9ea6 url("../images/wxicon.png") no-repeat scroll 10px -2514px;
            border-radius: 50%;
            display: inline-block;
            height: 30px;
            vertical-align: middle;
            width: 30px;
        }

        .top .number {
            float: right;
            font-size: 14px;
        }
        .top li {
            color: #fff;
            float: left;
            padding: 0 10px;
        }
        ul li {
            list-style: outside none none;
			/*padding-top:10px;*/
        }

        .center .two {
            width: 100px;
        }
        input, select {
            /*height: 24px;*/
            outline: medium none;
            /*padding-left: 5px;*/
        }

        .center {
           /* margin: 10px 15px 5px;*/
            overflow: hidden;
            width: 700px;
			margin:0 auto;
			font-size:14px;
			font-family:"微软雅黑"; 
        }
		.sum input{ width:100px; height:30px; text-align:center; line-height:30px; background-color:#F06A28; color:#fff;}
		.sum{ width:260px; margin:0 auto; margin-top:20px;}
		.layer form{ width:720px; margin:0 auto;}
		.room{ text-align:center;}
		.c_input{ width:160px; border:1px solid #d3d3d3; height:28px;}
		.button01{ margin-right:15px;}
		.button02{ margin-left:15px;}
		.zong_tan{ font-family:"微软雅黑"; font-size:14px;}
		.center span{ display:inline-block; width:320px; margin-top:20px;}
		.na{ width:130px!important; text-align:right;}
		.center input{ margin-left:10px;}
		.xia{ width:90px!important;}
		
    </style>
</head>

<body>
<div class="servicebox">
    <!--内容-->
    <P class="caption">当前位置 | 酒店管理 > 客房管理</P>
    <div class="content01">
    	<div class="caibox">
        <p class="title p_03">客房管理 <span class="neizhi"> | 设置房价</span></p>
        <!--内容94%-->
        <div class="roombox">
            <!--3大mune-->
            <ul class="room_menu">
                <li class="li_right moren_li li_01 no_click"><a href="?m=manage&a=getRoomsByFtId"  style="color:#fff;"><i class="i07"></i>按楼层</a></li>
                <li class="li_right li_02 no_click"><a href="?m=manage&a=getRoomsByTid" style="color:#fff;"><i class="i02"></i>按房型</a></li>
                <li class="li_03 click_green" onClick="tan_zhong();"><a href="javascript:window.location.reload();" style="color:#61c6d0;"><i class="i09"></i>设置房价</a></li>
            </ul>

            <!--tab内容-->
            <div class="tab_content">

                <!--设置房价-->
                <div class="set_price">
                    <table cellpadding="0" cellspacing="0">
                        <!--单人间-->
                        <!--<tr>
                            <th class="th01">房型</th>
                            <th>方案名称</th>
                            <th>支付类型</th>
                            <th>是否含餐</th>
                            <th>预订方式</th>
                            <th>房价（￥）</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>-->
                        <tr class="cap">
                            <td class="td01">房型</td>
                            <td class="td02">
                            	<table>
                                	<tr>
                                    	<td class="td03">方案名称</td>
                                        <td class="td04">支付类型</td>
                            			<td class="td05">是否含餐</td>
                            			<td class="td06">预订方式</td>
                                        <td class="td07">房价（￥）</td>
                                        <td class="td08">状态</td>
                                        <td class="td09">操作</td>
                                    </tr>
                                </table>
                            </td>   
                        </tr>

                        <{foreach from=$tres item=v key=k}>
                        <tr class="single">
                            <td class="standard td01"><{$v.name}></td>
                            <td class="td02" colspan="7">
                                <table>
                                <{foreach from=$v.pinfo item=a key=b}>
                                <tr class="single">
                                    <td class="td03"><{$a.name}></td>
                                    <td class="td04"><{if $a.pay_type==1}>预订<{else}>在线支付<{/if}></td>
                                    <td class="td05"><{if $a.is_breakfast==1}>含<{else}>不含<{/if}></td>
                                    <td class="td06"><{if $a.pay_type==1}>只能预订不能付款/电话预定<{else}>只能付款不能预订/电话预定<{/if}></td>
                                    <td class="td07"><{$a.pacific_price}>/<{$a.weekend_price}>/<{$a.special_price}></td>
                                    <td class="td08"><input type="radio" onclick="setstat(<{$a.id}>,1)"  name="status_<{$a.id}>"<{if $a.status==1}> checked='checked'<{/if}>>开启
                                        <input type="radio" onclick="setstat(<{$a.id}>,2)" class="input_radio"  name="status_<{$a.id}>"<{if $a.status==2}> checked='checked'<{/if}>>关闭
                                    </td>
                                    <td class="set td09" onclick="editpro(<{$a.id}>,this,'.zong_tan05')" >设置</td>
                                </tr>
                                <{/foreach}>
                                </table>
                            </td>
                        </tr>
                        <{if $v.pro_num<5}>
                        <tr class="single" onclick="addpro(<{$v.id}>,this,'.zong_tan')">
                            <td colspan="8" class="add"><i class="add_icon"></i>添加价格方案</td>
                        </tr>
                        <{/if}>
                    <{/foreach}>
                    </table>
                </div>
            </div>
        </div>
		</div>
    </div>

</div>
<!--弹出层-->
<div class="zong_tan popup" style="display: none;">
<div class="add_floor close_back" id="add_floor">
    
</div>
<div id="layer" class="layer floor_tan">
	<div class="floor_top">方案设置<a href="javascript:;" class="cd-popup-close"><i class="floor_close quxiao"></i></a></div>
    <form method="post" action="?m=manage&a=addProInfo" class="form1" onsubmit="return submitTest('form1');">
        
        <div class="center">
            <span>
            	<span class="na">方案名称：</span><input type="text" name="name" class="c_input">
            </span>
            <span>
            	<span class="na">是否含早餐：</span> 
                <span class="xia"><input type="radio"  name="is_breakfast" value="1" checked="checked">含</span>
                <span class="xia"><input type="radio"  name="is_breakfast" value="2">不含</span>
            </span>
            <span>
            	<span class="na">平常价：</span>
                <input type="text" name="pacific_price" class="c_input" onkeyup='checkDecimal(this)'>
            </span>
            <span>
            	<span class="na">周末价：</span>
                <input type="text" name="weekend_price" class="c_input" onkeyup='checkDecimal(this)'>
            </span>
            <span>
            	<span class="na">特殊价：</span>
                <input type="text" name="special_price" class="c_input" onkeyup='checkDecimal(this)'>
            </span>
            <span>
            	<span class="na">预订方式：</span>
                <span class="xia"><input type="radio"  name="pay_type" value="1" checked="checked">预订</span>
                <span class="xia"><input type="radio" name="pay_type" value="2">在线支付</span>
            </span>
            <span>
            	<span class="na">状态：</span> 
                <span class="xia"><input type="radio"  name="status" value="1" checked="checked">开启</span>
                <span class="xia"><input type="radio"  name="status" value="2" >关闭</span>
            </span>
        </div>
        <div class="sum">
        	<input type="submit" value="保存" class="button01"><input type="button" class="close quxiao button02" value="关闭">
        </div>
        <input type="hidden" id="ptid" value="" name="tid"/>
    </form>
</div>
</div>
<div class="zong_tan05 popup" style="display: none;">
<div class="add_floor close_back" id="add_floor">
    
</div>
<div id="layer_edit" class="layer_edit floor_tan">
    <form method="post" action="?m=manage&a=setProInfo" class="form2" onsubmit="return submitTest('form2');">
        <div class="floor_top">方案设置<a href="javascript:;" class="cd-popup-close"><i class="floor_close quxiao"></i></a></div>
        <div class="center">
            <span>
            	<span class="na">方案名称：</span>
                <input type="text" name="name" id="p_name">
            </span>
            <span>
            	<span class="na">是否含早餐：</span>
                <span class="xia"><input type="radio"  name="is_breakfast" value="1" checked="checked">含</span>
                <span class="xia"><input type="radio"  name="is_breakfast" value="2">不含</span>
            </span>
            <span>
            	<span class="na">平常价：</span>
                <input type="text" id="p_pacific_price" name="pacific_price" onkeyup='checkDecimal(this)'>
            </span>
            <span>
            	<span class="na">周末价：</span>
                <input type="text" id="p_weekend_price" name="weekend_price" onkeyup='checkDecimal(this)'>
            </span>
            <span>
            	<span class="na">特殊价：</span>
                <input type="text" id="p_special_price" name="special_price" onkeyup='checkDecimal(this)'>
            </span>
            <span>
            	<span class="na">预订方式：</span> 
                <span class="xia"><input type="radio"  name="pay_type" value="1" checked="checked">预订</span>
                <span class="xia"><input type="radio" name="pay_type" value="2">在线支付</span>
            </span>
            <span>
            	<span class="na">状态：</span>
                <span class="xia"><input type="radio" name="status" value="1" checked="checked">开启</span>
                <span class="xia"><input type="radio"  name="status" value="2">关闭</span>
            </span>
        </div>
        <div class="sum">
        	<input type="submit" value="保存" class="button01"> 
            <input type="button" class="close_edit quxiao button02" value="关闭">
        </div>
        <input type="hidden" id="ptid_edit" value="" name="pid"/>
    </form>
</div>
</div>
<script>
    function setstat(pid,stat){
        var url = '?m=manage&a=setProStat&pid='+pid+'&status='+stat;
        $.get(url,function(data){
            if(data.stat==1){
                alert(data.msg);
                window.location.reload();
            }else{
                alert(data.msg);return;
            }
        },'json');
    }

    function addpro(id,t,layer){
        $('#ptid').val(id);
		getheigth(t,layer);
    }

    function editpro(id,t,layer){
        var url = "?m=manage&a=getPinfoByIdAjax&id="+id;
        $.get(url,function(data){
            $('#ptid_edit').val(id);
            $('#p_name').val(data.msg.name);
            $('#p_pacific_price').val(data.msg.pacific_price);
            $('#p_weekend_price').val(data.msg.weekend_price);
            $('#p_special_price').val(data.msg.special_price);
            $("#layer_edit input[name='pay_type'][value='"+data.msg.pay_type+"']").attr("checked",true);
            $("#layer_edit input[name='is_breakfast'][value='"+data.msg.is_breakfast+"']").attr("checked",true);
            $("#layer_edit input[name='status'][value='"+data.msg.status+"']").attr("checked",true);
        },'json');
		getheigth(t,layer);
    }

	function checkDecimal(n){ 
		var num=''; 
		var decimalReg=/^\d{0,8}\.{0,1}(\d{1,2})?$/;//var decimalReg=/^[-\+]?\d{0,8}\.{0,1}(\d{1,2})?$/; 
		if(n.value!=""&&decimalReg.test(n.value)){ 
			num=n.value; 
		}else{ 
			if(n.value!=""){ 
				n.value=num; 
			} 
		} 
	} 
	function submitTest(form){
		var name = $('.'+form+" input[name='name']"),
			pacific_price = $('.'+form+" input[name='pacific_price']"),
			weekend_price = $('.'+form+" input[name='weekend_price']"),
			special_price = $('.'+form+" input[name='special_price']");
		if (name.val()==""){
			alert('请输入方案名称');
			return false;
		}
		if (pacific_price.val()==""){
			alert('请输入平常价');
			return false;
		}
		if (weekend_price.val()==""){
			alert('请输入周末价');
			return false;
		}
		if (special_price.val()==""){
			alert('请输入特殊价');
			return false;
		}
	}
	$('.popup .quxiao').click(function(){
		$('.popup').hide();
	})

</script>
</body>
</html>
